/**
 * 将时间解析成秒s
 * @param {*} arr
 * @returns
 */
const parseTime = (arr) => { 
  const times = arr.split(":");
  const seconds = parseFloat(times[0]) * 60+parseFloat(times[1]);
  return seconds;
}

const analysisLrc = (lrc) => { //解析字符串
  // 以\n为分隔符
  const lines = lrc.split("\n");
  const result = lines.map(item => {
    const itemArr = item.split("]");
    const singleData = {
      time: parseTime(itemArr[0].substring(1)),
      value: itemArr[1]
    }
    return singleData
  })
  return result;
}

export {
  analysisLrc
}
